package cn.iocoder.yudao.module.promotion.dal.mysql.rankinglist;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.promotion.controller.admin.rankinglist.vo.RankingListPageReqVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.rankinglist.RankingListDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 活动排行榜 Mapper
 *
 * @author 万民匠心
 */
@Mapper
public interface RankingListMapper extends BaseMapperX<RankingListDO> {

    default PageResult<RankingListDO> selectPage(RankingListPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RankingListDO>()
                .likeIfPresent(RankingListDO::getName, reqVO.getName())
                .betweenIfPresent(RankingListDO::getStartTime, reqVO.getStartTime())
                .betweenIfPresent(RankingListDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(RankingListDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(RankingListDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(RankingListDO::getStoreScale, reqVO.getStoreScale())
                .eqIfPresent(RankingListDO::getContent, reqVO.getContent())
                .eqIfPresent(RankingListDO::getImages, reqVO.getImages())
                .eqIfPresent(RankingListDO::getSlogans, reqVO.getSlogans())
                .orderByDesc(RankingListDO::getId));
    }

}